package com.dddpeter.yater;


import android.os.Bundle;
import android.view.Menu;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import net.tsz.afinal.FinalActivity;
import net.tsz.afinal.annotation.view.ViewInject;

public class FlowerGrowActivity extends FinalActivity {
	@ViewInject(id = R.id.radioGroup1)
	RadioGroup rg;
	@ViewInject(id = R.id.radio0)
	RadioButton rb1;
	@ViewInject(id = R.id.radio1)
	RadioButton rb2;
	@ViewInject(id = R.id.radio2)
	RadioButton rb3;
	@ViewInject(id = R.id.flowerView1)
	FlowerView flowerView;
	int flowerType=R.drawable.meigui;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_flower_grow);
		flowerView.setFlowerType(flowerType);
		rg.setOnCheckedChangeListener(new OnCheckedChangeListener() {

			public void onCheckedChanged(RadioGroup arg0, int id) {
				if(id==rb1.getId()){
					flowerType=R.drawable.meigui;
					
				}
				else if(id==rb2.getId()){
					flowerType=R.drawable.hehua;
				}
				
				else if(id==rb3.getId()){
					flowerType=R.drawable.juhua;
					
				}
				
				flowerView.setFlowerType(flowerType);
				
				
			}
		});
	
			
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		
		return true;
	}

}
